﻿using System;
using System.Windows.Forms;
using EasyComm.Logging;

namespace EasyComm.SDK.WinTest
{
    public partial class LogForm : Form
    {
        public LogForm()
        {
            InitializeComponent();
            EasyCommContext.Log += new Logging.LogEventHandler(EasyCommContext_Log);
        }

        void EasyCommContext_Log(object sender, LogEventArgs e)
        {
            richTextBox1.AppendText(string.Format("[{0}] [{1}] {2}", DateTime.Now.ToShortTimeString(), e.MessageType, e.Message));
        }

        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            EasyCommContext.Log -= new Logging.LogEventHandler(EasyCommContext_Log);
        }
    }
}
